#pragma once
#include "TGDKImage.h"

class TGDKSprite
{
	private:
		static int global_SpriteNo;
		static int global_MaxSpritePriority;
		TGDKImage& UsedImage;		
		int SpriteNo;		
		int Priority;		
		int Cols;
		int Rows;
		float Angle;
		int Delay;
		enum ANIMATE_STATE {IDLE,ANIMATE_LOOP,ANIMATE_ONCE};
		ANIMATE_STATE AState;		
		bool bSized;
		int Width;
		int Height;
	public:		
		float XPos;
		float YPos;		
		//TGDKSprite(TGDKImage& img,TGDKSprite* insert_after,int x=0,int y=0);
		TGDKSprite(TGDKImage& img,TGDKSprite* insert_after,int x=0,int y=0, int iAcross=0, int iDown=0,int delay=0);		
		~TGDKSprite();	
		void Update();
		void Animate(int delay);
		void AnimateLoop();
		void AnimateOnce();
        bool AnimationDone();
		bool IsAnimated();
		void Refresh();
		void SetMaxPriority();
		void SetPriority(int value);
		int GetPriority() {return Priority; };
		void SetAngle(float fAngle);
		float GetAngle();
		void SetScale(int iScale);
		void SetAlpha(int value);		
		int GetAlpha();
		void Show();
		void Hide();
		bool Visible();
		void Flip();
		void Mirror();				
		void SetSpriteFrame(int frame);
		void SetImage(TGDKImage& img);
		void SetDiffuse(int iRed, int iGreen, int iBlue);	
		int GetWidth();
		int GetHeight();
		void SetOffset(int x,int y);
		int GetOffsetX();
		int GetOffsetY();
		void CenterOffset();
		bool Collision(TGDKSprite *target);		
		void Move(float vel);
		void SetSize(int x,int y);		
		int GetSpriteFrame();
		int GetMaxSpriteFrame();
        int GetX();
        int GetY();
};
